import { BasicArrow } from '/@/components/Basic';
import { listChildren} from './DbSecurity.api';
import {ref,reactive} from 'vue';
export default () => {
  const times = ref(0);
  const ress = reactive([]);
  return  (props: Recordable) => {

    if(1==1 && props.record?.showExpandIcon==undefined) {
      //times.value++;
      console.log(times.value)
      console.log(props)
      let res = listChildren({enterprisename: props.record.enterprisename, checktime: props.record.checktime});

      res.then((data) => {
        if (data.length > 0) {
          //ress.values[ress.values.length].push(props.record);
          console.log(data)
          props.record.showExpandIcon = true;
        }else{
          props.record.showExpandIcon = false;
        }
      })
    }
    if(1==1) {
      if (!props.record.showExpandIcon) {
        return <span/>;
      } else {
        return (
          <BasicArrow
            style="margin-right: 8px"
            iconStyle="margin-top: -2px;"
            onClick={(e: Event) => {
              props.onExpand(props.record, e);
            }}
            expand={props.expanded}
          />
        );
      }
    }
    if (!props.expandable) {
      if (props.needIndentSpaced) {
        return <span class="ant-table-row-expand-icon ant-table-row-spaced" />;
      } else {
        return <span />;
      }
    }
    return (
      <BasicArrow
        style="margin-right: 8px"
        iconStyle="margin-top: -2px;"
        onClick={(e: Event) => {
          props.onExpand(props.record, e);
        }}
        expand={props.expanded}
      />
    );
  };
};
